<h1>NÚMERO DE SOLICITUDES DE ACREDITACIÓN REGISTRADAS</h1>
<table>
	<tr class="yellow">
		<td class="width">PAÍS</td>
		<td class="adjacent">NÚMERO DE REGISTRADOS</td>		
	</tr>

<?php

	$connection = Yii::app()->db;
	
	$command = $connection->createCommand("
	SELECT count(gin.inscripcion_nominal_id) as registrados,gu.pais
    FROM grid_inscripcion_nominal gin 
    
    inner join grid_persona gp 
    on gin.inscripcion_nominal_persona = gp.persona_id
    
    inner join grid_pais gpa
    on gpa.pais_id = gp.persona_pais
    
    inner join grid_pais gpai
    on gpai.pais_id = gp.persona_nacionalidad
    
    inner join grid_categoria_aplica gca
    on gca.categoria_aplica_id = gin.inscripcion_nominal_aplica
    
    inner join grid_deporte_actividad gda
    on gda.deporte_actividad_id = gin.inscripcion_nominal_deporte_actividad
    
    inner join grid_users gu
    on gu.id=gp.user_id
    
    inner join grid_categoria gc
    on gc.categoria_id=gin.inscripcion_nominal_categoria
    
    where gin.inscripcion_nominal_estado='REGISTRADO'
    
    group by gu.pais");
		
	$dataReader = $command->query();

	$datos = $dataReader->readAll();
		
	foreach ($datos as $dato)	
		echo "<tr><td>".strtoupper($dato['pais'])."</td><td>{$dato['registrados']}</td></tr>";
		
?>
</table>
